<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>会员积分调整</h2>
    </div>
    <hr>
    <form action="{:U('Member/integral')}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">会员电话</label>
            <div class="controls">
                 <input type="text" class="text input-large" name="user_tel" id="user_tel">
                 <button class="btn ajax-post" id="get">获取</button>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">当前积分（不可编辑）</label>
            <div class="controls">
                 <input type="text" class="text input-large" name="user_introducer" readonly="readonly" value="">
            </div>
        </div>
        <label class="item-label">操作方式</label>
        <div class="controls">
            <select name="way">
                <option value="+" selected="">+</option>
                <option value="-">-</option>
            </select>
            <input type="number" class="text input-large" name="user_integral">
        </div>
        <div class="form-item">
                <label class="item-label">操作原因</label>
                <div class="controls">
                <label class="textarea input-large">
                    <textarea name="user_content"></textarea>
                </label>
                </div>
        </div>
    </form>
    <div class="controls">
            <button type="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>               
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
    </div>                     
</block>

<block name="script">
    <script>
        $('#get').click(function() {
            $.post("{:U('Member/integral_getinfo')}",{'tel':$('#user_tel').val()},function (data) {
                if (data.reg == 2) {
                    alert(data.info);
                } else {
                    $("input[name='user_introducer']").val(data['info'].integral);
                }
            });
        });
    </script>
</block>
